package com.yfp.client.mapper;

import com.yfp.client.domain.ClientCoupon;
import com.yfp.client.domain.vo.LotteryRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 客户优惠券
 *
 * @CreateDate: 2024/7/15 11:10
 * @UpdateUser:
 * @UpdateDate: 2024/7/15 11:10
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
@Mapper
public interface ClientCouponMapper {

    /**
     * 查询个人单券
     *
     * @param couponId
     * @param clientId
     * @return
     */
    ClientCoupon findByCouponIdAndClientId(@Param("couponId") Long couponId, @Param("clientId") String clientId);

    /**
     * 查询个人单券
     *
     * @param id
     * @param clientId
     * @return
     */
    ClientCoupon findByIdAndClientId(@Param("id") Long id, @Param("clientId") String clientId);

    /**
     * 新增
     *
     * @param clientCoupon
     */
    Long insert(ClientCoupon clientCoupon);

    /**
     * 统计单券
     *
     * @param clientId
     * @param couponId
     * @return
     */
    Integer countByClientIdAndCouponId(@Param("clientId") String clientId, @Param("couponId") Long couponId, @Param("statusList") List<Integer> statusList);

    Integer countByClientIdAndCouponIdAndMiniBannerId(@Param("clientId") String clientId, @Param("couponId") Long couponId, @Param("miniBannerId") Long miniBannerId);

    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    ClientCoupon findById(Long id);

    List<ClientCoupon> findByIds(@Param("ids") List<Long> ids);

    /**
     * 查询个人优惠券
     *
     * @param status
     * @param clientId
     * @return
     */
    List<ClientCoupon> findListByStatusAndClientId(@Param("status") Integer status, @Param("clientId") String clientId);

    /**
     * 查询个人优惠券
     *
     * @param status
     * @param clientId
     * @param days
     * @return
     */
    List<ClientCoupon> findListByStatusAndClientIdAndDays(@Param("status") Integer status, @Param("clientId") String clientId, @Param("days") Integer days);

    /**
     * 查询个人优惠券
     *
     * @param status
     * @param clientId
     * @param days
     * @return
     */
    List<ClientCoupon> findListByInvalidStatusAndClientIdAndDays(@Param("status") Integer status, @Param("clientId") String clientId, @Param("days") Integer days);

    /**
     * 查询个人优惠券
     *
     * @param clientId
     * @param status
     * @param cityName
     * @return
     */
    List<ClientCoupon> getClientCouponListByClientIdAndStatusType(@Param("clientId") String clientId, @Param("status") Integer status, @Param("cityName") String cityName);

    /**
     * 修改状态
     *
     * @param id
     * @param status
     */
    void updateStatusById(@Param("id") Long id, @Param("status") Integer status);

    List<String> findCouponSysDictData();

    /**
     * 查询领券中心的个人券
     *
     * @param status
     * @param clientId
     * @return
     */
    List<ClientCoupon> findCouponCentre(@Param("status") Integer status, @Param("clientId") String clientId);

    /**
     * 统计已领取礼包券数
     *
     * @param couponPackId
     * @param clientId
     * @return
     */
    int countByCouponPackIdAndClientIdInt(@Param("couponPackId") Long couponPackId, @Param("clientId") String clientId);

    /**
     * @param couponPackId
     * @param clientId
     * @param miniBannerId
     * @return
     */
    int countByCouponPackIdAndClientIdAndMiniBannerId(@Param("couponPackId") Long couponPackId, @Param("clientId") String clientId, @Param("miniBannerId") Long miniBannerId);

    /**
     * 获取优惠券信息
     *
     * @param lrcrIds
     * @return
     */
    List<LotteryRecordVO> lotteryRecord(@Param("lrcrIds") List<Long> lrcrIds);

    /**
     * 获取活动签到领取的优惠券
     *
     * @param clientId
     * @param activitySignInsClientRecordsIdList
     * @return
     */
    List<ClientCoupon> getActivitySignInsClientRecordsById(@Param("clientId") String clientId, @Param("activitySignInsClientRecordsIdList") List<Long> activitySignInsClientRecordsIdList);

    /**
     * 修改活动签到领取的优惠券
     *
     * @param activitySignInsClientRecordsId
     * @param clientCouponIdList
     */
    void editActivitySignInsClientRecordsId(@Param("activitySignInsClientRecordsId") Long activitySignInsClientRecordsId, @Param("clientCouponIdList") List<Long> clientCouponIdList);
}
